home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
6_3.lha
/
6_3
/
tst1.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
1KB
|
50 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
include <strclass.h>
include <substr.h>
ain()
string w = "abcdefghijklmnop";
string x = "0123456789wxyz";
cout << "w=" << w;
cout << "x=" << x;
cout << "w(5)=" << w(5);
string y = w(5,3);
cout << "y=w(5,3)=" << y;
cout << "x(-5)=" << x(-5);
cout << "x(-5,3)=" << x(-5,3);
cout << "x(0)=" << x(0);
cout << "x(0,2)=" << x(0,2);
cout << "x(11,8)=" << x(11,8);
cout << "x(8,4)=" << x(8,4);
cout << "\nx=" << x;
x(2,2) = string("$$");
cout << "x(2,2)='$$'\n";
cout << "x=" << x << "\n";
string z = x;
cout << "\nz=" << z << "x=" << x;
x(8,4) = string("WXYZ");
cout << "x(8,4)='WXYZ'\n";
cout << "x=" << x << "z=" << z << "\n";
ifdef TSTD
z = x;
cout << "\nz=" << z << "x=" << x;
x(2,6) = string("QQQQ");
cout << "x(2,6)='QQQQ'\n";
cout << "x=" << x << "z=" << z << "\n";
z = x;
cout << "\nz=" << z << "x=" << x;
x(8,2) = string("!!!!");
cout << "x(8,2)='!!!!'\n";
cout << "x=" << x << "z=" << z << "\n";
endif
return 0;